package com.ehsy.service;

import com.dtflys.forest.annotation.*;
import com.ehsy.common.ResponseVo;
import com.ehsy.config.TestLogHandler2;
import com.ehsy.model.UserInfo;
import org.springframework.stereotype.Component;

/**
 * @author YanZhen_Li
 * @version 1.0
 * @title LogService
 * @description
 * @create 2024/6/19 9:41
 */
@Component
@Address(host = "127.0.0.1", port = "8080")
public interface LogService {
    /**
     * 默认开关：允许打印请求日志、响应状态日志，但不答应响应内容日志
     */
    @Get("/test/request/json/body")
    @LogEnabled // 同@LogEnabled(true)
    ResponseVo<UserInfo> test1(@Query UserInfo user);

    /**
     * 关闭所有日志
     */
    @Get("/test/request/json/body")
    @LogEnabled(false)
    ResponseVo<UserInfo> test2(@Query UserInfo user);

    /**
     * 打印所有日志
     * <table summary = "@LogEnabled的注解各属性如下">
     *     <tr>
     *         <th>属性</th>
     *         <th>作用</th>
     *         <th>默认值</th>
     *     </tr>
     *     <tr>
     *         <td><code>value</code></td>
     *         <td>是否打印请求/响应日志</td>
     *         <td>true</td>
     *     </tr>
     *     <tr>
     *         <td><code>logRequest</code></td>
     *         <td>是否打印请求日志</td>
     *         <td>true</td>
     *     </tr>
     *     <tr>
     *         <td><code>logResponseStatus</code></td>
     *         <td>是否打印响应状态日志</td>
     *         <td>true</td>
     *     </tr>
     *     <tr>
     *         <td><code>logResponseContent</code></td>
     *         <td>是否打印响应内容日志</td>
     *         <td>false</td>
     *     </tr>
     * </table>
     * */
    @Get("/test/request/json/body")
    @LogEnabled(logRequest = true, logResponseStatus = true, logResponseContent = true)
    ResponseVo<UserInfo> test3(@Query UserInfo user);

    @Get("/test/request/json/body")
    @LogEnabled(logRequest = true, logResponseStatus = true, logResponseContent = true)
    @LogHandler(TestLogHandler2.class)
    ResponseVo<UserInfo> test4(@Query UserInfo user);
}
